import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
import Layout from '@/src/layout/main.vue'

import { ZkContentEditor, ZkContentAiToolBox } from '~/dist/es/index.js'
const routes = [
  {
    path: '/',
    redirect: '/demo'
  },
  {
    path: '/',
    component: Layout,
    redirect: '/demo',
    children: [
      {
        path: '/demo',
        name: 'Demo',
        component: () => import('@/src/views/demo.vue')
      },
      {
        path: '/tool/:id',
        name: 'ZkContentAiTool',
        component: ZkContentAiToolBox
      },
      {
        path: '/editor',
        name: 'Editor',
        component: ZkContentEditor,
        props: { content: "这是一段来自父组件的内容" }
      },
    ]
  },
  {
    path: '/*',
    redirect: '/demo'
  },
]

const router = createRouter({
  routes,
  history: createWebHistory()
})

// router.beforeEach((to, from, next) => {
//   next()
// })

export default router